<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/basicTemplate.xhtml">
	<ui:define name="content">
		<h:inputHidden rendered="#{menuController.userRank != 1}" value="#{menuController.redirect()}"></h:inputHidden>
		<h:inputHidden rendered="#{menuController.userRank == 1}">
		<body>
		<f:view>
			<h:form>
				<h:panelGrid border="0" columns="2">
					<h:panelGroup>
					<div class="firstBigTest">
						<h:panelGrid border="0" columns="2" styleClass="inner-table" columnClasses="firstTest">
							
							<h:outputText value="Choose existing template:"></h:outputText>
							<h:selectOneListbox id="templateListBox" size="1"
								value="#{interviewController.selectedTemplateID}"
								styleClass="droplist dropListDay">
								<f:selectItems value="#{interviewController.templateDTOs}"
									var="item" itemLabel="#{item.title}" itemValue="#{item.id}" />
								<f:ajax execute="@this"
									listener="#{interviewController.displayDetails}"
									render="detailsArea" />
							</h:selectOneListbox>
							
						</h:panelGrid>
						</div>
					</h:panelGroup>
					<h:inputTextarea id="detailsArea" readonly="true"
						value="#{interviewController.details}" cols="55" rows="10"
						styleClass="textarea" />

					<h:panelGrid id="time" border="0" columns="2"
						styleClass="inner-table" columnClasses="firstTest">						
						<h:outputText value="Allocate room:"></h:outputText>
						<h:selectOneListbox id="roomListBox" size="1"
							value="#{interviewController.selectedRoomID}"
							styleClass="droplist dropListDay">
							<f:selectItems value="#{interviewController.roomDTOs}" var="item"
								itemLabel="#{item.address}" itemValue="#{item.id}" />
							<f:ajax execute="@this"
								listener="#{interviewController.getNumberOfStations}"
								render="panel" />
						</h:selectOneListbox>
						<h:outputText value="Interview date: "></h:outputText>
						<h:selectOneListbox id="weekListBox" size="1"
							value="#{interviewController.selDate}"
							styleClass="droplist dropListDay">
							<f:selectItems value="#{interviewController.weekDate}" />
							<f:ajax execute="@this"
								listener="#{interviewController.getDateTime}"
								render="startHourListBox endHourListBox startMinListBox endMinListBox" />
						</h:selectOneListbox>
						<h:outputText value="Interview start time (hh:mm): "></h:outputText>
						<h:panelGroup>
							<h:selectOneListbox id="startHourListBox" size="1"
								value="#{interviewController.selectedStartHour}"
								styleClass="droplist">
								<f:selectItems value="#{interviewController.hours}" />
								<f:ajax execute="@this"
									listener="#{interviewController.getDateTime}"
									render="endHourListBox" />
							</h:selectOneListbox>
							<h:outputText value=":"></h:outputText>
							<h:selectOneListbox id="startMinListBox" size="1"
								value="#{interviewController.selectedStartMinute}"
								styleClass="droplist">
								<f:selectItems value="#{interviewController.minutes}" />
								<f:ajax execute="@this"
									listener="#{interviewController.getDateTime}"
									render="endMinListBox" />
							</h:selectOneListbox>
						</h:panelGroup>
						<h:outputText value="Interview end time (hh:mm): "></h:outputText>
						<h:panelGroup>
							<h:selectOneListbox id="endHourListBox" size="1"
								value="#{interviewController.selectedEndHour}"
								styleClass="droplist">
								<f:selectItems value="#{interviewController.endHours}" />
								<f:ajax execute="@this"
									listener="#{interviewController.restartEndMinutes}"
									render="endMinListBox" />
							</h:selectOneListbox>
							<h:outputText value=":"></h:outputText>
							<h:selectOneListbox id="endMinListBox" size="1"
								value="#{interviewController.selectedEndMinute}"
								styleClass="droplist">
								<f:selectItems value="#{interviewController.endMinutes}" />
								<f:ajax execute="@this"
									listener="#{interviewController.setEndMinutes}"
									render="endMinListBox" />
							</h:selectOneListbox>
						</h:panelGroup>
						
							<h:commandButton value="Save interview"
								rendered="#{!interviewController.reschedule}"
								styleClass="button">
								<f:ajax execute="@this"
									listener="#{interviewController.saveInterview}"
									render="panel error startHourListBox endHourListBox startMinListBox endMinListBox" />
							</h:commandButton>
							<h:commandButton value="Back" styleClass="button"
								action="#{viewCandidatesBean.backFromView}">
							</h:commandButton>
							<h:commandButton rendered="#{interviewController.reschedule}"
								value="Reschedule" styleClass="button"
								action="#{interviewController.newSchedule}">
							</h:commandButton>
						
						
					</h:panelGrid>
					
					<h:panelGroup>
						<h5 style="text-align: center"><h:outputText id="current"
							value="#{interviewController.currentWeek}"></h:outputText></h5>
						<h:panelGrid id="panel" columns="7" style="text-align: center"
							width="100%">
							<f:facet name="header">
								<h:outputText value="Hour" />
							</f:facet>
							<f:facet name="header">
								<h:outputText value=" &nbsp;&nbsp;Mon&nbsp;&nbsp; " />
							</f:facet>
							<f:facet name="header">
								<h:outputText value="  &nbsp;&nbsp;&nbsp;Tue&nbsp;&nbsp; " />
							</f:facet>
							<f:facet name="header">
								<h:outputText value="  &nbsp;&nbsp;&nbsp;Wed &nbsp;&nbsp;" />
							</f:facet>
							<f:facet name="header">
								<h:outputText value="  &nbsp;&nbsp;&nbsp;Thu&nbsp;&nbsp; " />
							</f:facet>
							<f:facet name="header">
								<h:outputText value="  &nbsp;&nbsp;&nbsp;Fri&nbsp;&nbsp; " />
							</f:facet>
							<f:facet name="header">
								<h:outputText
									value="  &nbsp; &nbsp;&nbsp;&nbsp;Sat&nbsp;&nbsp; " />
							</f:facet>
							<h:outputText value="08-09"></h:outputText>
							<h:outputText
								styleClass=" #{interviewController.colorList.get(0)} "
								
								value="#{interviewController.schedule.get(0)}/#{interviewController.totalRooms}"></h:outputText>
								
							<h:outputText
								styleClass="#{interviewController.colorList.get(9)}"
								value="#{interviewController.schedule.get(9)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(18)}"
								value="#{interviewController.schedule.get(18)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(27)}"
								value="#{interviewController.schedule.get(27)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(36)}"
								value="#{interviewController.schedule.get(36)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(45)}"
								value="#{interviewController.schedule.get(45)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="09-10"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(1)}"
								value="#{interviewController.schedule.get(1)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(10)}"
								value="#{interviewController.schedule.get(10)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(19)}"
								value="#{interviewController.schedule.get(19)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(28)}"
								value="#{interviewController.schedule.get(28)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(37)}"
								value="#{interviewController.schedule.get(37)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(46)}"
								value="#{interviewController.schedule.get(46)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="10-11"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(2)}"
								value="#{interviewController.schedule.get(2)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(11)}"
								value="#{interviewController.schedule.get(11)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(20)}"
								value="#{interviewController.schedule.get(20)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(29)}"
								value="#{interviewController.schedule.get(29)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(38)}"
								value="#{interviewController.schedule.get(38)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(47)}"
								value="#{interviewController.schedule.get(47)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="11-12"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(3)}"
								value="#{interviewController.schedule.get(3)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(12)}"
								value="#{interviewController.schedule.get(12)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(21)}"
								value="#{interviewController.schedule.get(21)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(30)}"
								value="#{interviewController.schedule.get(30)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(39)}"
								value="#{interviewController.schedule.get(39)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(48)}"
								value="#{interviewController.schedule.get(48)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="12-13"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(4)}"
								value="#{interviewController.schedule.get(4)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(13)}"
								value="#{interviewController.schedule.get(13)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(22)}"
								value="#{interviewController.schedule.get(22)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(31)}"
								value="#{interviewController.schedule.get(31)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(40)}"
								value="#{interviewController.schedule.get(40)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(49)}"
								value="#{interviewController.schedule.get(49)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="13-14"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(5)}"
								value="#{interviewController.schedule.get(5)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(14)}"
								value="#{interviewController.schedule.get(14)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(23)}"
								value="#{interviewController.schedule.get(23)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(32)}"
								value="#{interviewController.schedule.get(32)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(41)}"
								value="#{interviewController.schedule.get(41)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(50)}"
								value="#{interviewController.schedule.get(50)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="14-15"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(6)}"
								value="#{interviewController.schedule.get(6)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(15)}"
								value="#{interviewController.schedule.get(15)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(24)}"
								value="#{interviewController.schedule.get(24)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(33)}"
								value="#{interviewController.schedule.get(33)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(42)}"
								value="#{interviewController.schedule.get(42)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(51)}"
								value="#{interviewController.schedule.get(51)}/#{interviewController.totalRooms}"></h:outputText>


							<h:outputText value="15-16"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(7)}"
								value="#{interviewController.schedule.get(7)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(16)}"
								value="#{interviewController.schedule.get(16)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(25)}"
								value="#{interviewController.schedule.get(25)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(34)}"
								value="#{interviewController.schedule.get(34)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(43)}"
								value="#{interviewController.schedule.get(43)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(52)}"
								value="#{interviewController.schedule.get(52)}/#{interviewController.totalRooms}"></h:outputText>

							<h:outputText value="16-17"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(8)}"
								value="#{interviewController.schedule.get(8)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(17)}"
								value="#{interviewController.schedule.get(17)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(26)}"
								value="#{interviewController.schedule.get(26)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(35)}"
								value="#{interviewController.schedule.get(35)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(44)}"
								value="#{interviewController.schedule.get(44)}/#{interviewController.totalRooms}"></h:outputText>
							<h:outputText
								styleClass="#{interviewController.colorList.get(53)}"
								value="#{interviewController.schedule.get(53)}/#{interviewController.totalRooms}"></h:outputText>
						</h:panelGrid>
						<h:commandButton id="next"
							value="#{interviewController.nextButton}" styleClass="button">
							<f:ajax event="action" execute="@this"
								listener="#{interviewController.changeButtonValue}"
								render="startHourListBox endHourListBox startMinListBox endMinListBox current next panel" />

						</h:commandButton>


					</h:panelGroup>
				</h:panelGrid>
				<h3>
				<h:outputText id="error"
					value="#{interviewController.errorMessage}" styleClass="#{interviewController.messageClass}"></h:outputText>
					</h3>
			</h:form>
		</f:view>
		</body>
		</h:inputHidden>
	</ui:define>
</ui:composition>
</html>